<?php
	$action = isset($_POST['action'])?$_POST['action']:'';
	if($action == 'login'){
		echo json_encode($_POST);
	}else{
		require('template.php');
		get_head_template('登录');
?>
	<body class="login">
		<div id="loading-modal" class="modal hide fade in modal-override">
			<div class="modal-body">
				<img src="img/loading.gif" alt />
			</div>
			<div class="modal-footer">
				<h5>正在登录</h5>
			</div>
		</div>
		<section id="login-bodyer" class="container center">
			<div class="logo">
				<img src="static/img/logo.png" alt />
			</div>
			<div class="row">
				<div id="ie-warning" class="span8 offset2 alert alert-danger fade in">
					<button type="button" class="close" data-dismiss="alert">×</button>
					 请注意，该页面并不支持低于IE8的浏览器，为了获得最佳效果，请下载最新的浏览器，推荐下载 
					 <a href="http://www.google.cn/intl/zh-CN/chrome/" target="_blank">Chrome</a>
				</div>
				<div id="error-msg" class="span8 offset2 alert alert-error fade in">
					<button type="button" class="close" data-dismiss="alert">×</button>
					 用户名或密码错误
				</div>
			</div>
			
			<form id="form-login" method="post" action="#" class="form-inline">
				<div class="input-prepend">
					<span class="add-on"> <i class="icon-user"></i> </span>
					<input type="text" name="username" class="input-custom" placeholder="用户名" />
				</div>
				<div class="input-prepend">
					<span class="add-on"> <i class="icon-lock"></i> </span>
					<input type="password" name="password" class="input-custom" placeholder="密码" />
				</div>
				<input type="hidden" name="action" value="login">
				<button id="btnSubmit" type="button" class="btn btn-large btn-primary" data-loading-text="登录中">
					登录
				</button>
			</form>
		</section>

		<script src="static/js/jquery.js"></script>
		<script src="static/js/bootstrap.min.js"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				$('#login-bodyer').css('margin-top',($(window).height()-44)/2-200);
				$("input[name=username]").focus();
				var isIE = navigator.userAgent.indexOf(' MSIE ') > -1;
				if(isIE) {
					$(".modal").removeClass("fade");
				}
				$("#btnSubmit").click(function() {
					var btn = $(this);
					$.ajax({
						type: "post",
						url: "index.php",
						dataType: "json",
						data: $("#form-login").serialize(),
						beforeSend : function() {
							$("#loading-modal").modal("toggle");
							btn.button("loading");
						},
						complete : function(obj, status) {
							$("#loading-modal").modal("toggle");
							btn.button("reset");
						},
						error: function() {
							
						},
						success: function(result){
						}
						// ......
					});
					return false;
				});
			});
		</script>
	</body>
</html>
<?php
}
?>